import { PORT3 } from "@/api/config/servicePort";
import http from "@/api";
import { defaultParams } from "@/interface/public";
import { Smash, SmashIn, SmashOut } from "../interface/smash";

/**
 * @name 撕碎
 */

interface ItemProp {
  workerId: string;
  id: string;
}

interface ItemProp2 {
  workerId: string;
  itemIds: string;
}

// --------投入------
// 1-保存数据
export const smashInSave = (params: SmashIn.Save) => http.post(PORT3 + `/smashIn/save`, params);

// 2-删除数据
export const smashInRemove = (params: ItemProp) => http.post(PORT3 + `/smashIn/remove`, params);

// 3-查询工单下投入明细
export const smashInItemByWorker = (params: defaultParams) =>
  http.get<Smash.searchDetail>(PORT3 + `/smashIn/itemByWorker/${params.id}`);

// --------产出------
// 1-保存数据
export const smashOutSave = (params: SmashOut.Save) => http.post(PORT3 + `/smashOut/save`, params);

// 2-删除数据
export const smashOutRemove = (params: ItemProp) => http.post(PORT3 + `/smashOut/remove`, params);

// 3-查询工单下投入明细
export const smashOutItemByWorker = (params: defaultParams) => http.get(PORT3 + `/smashOut/itemByWorker/${params.id}`);

// 6-查询工单下待发送入库的列表
export const smashOutListByWaitSend = (params: defaultParams) => http.get(PORT3 + `/smashOut/listByWaitSend/${params.id}`);

//6.1-发送入库
export const smashOutSend = (params: ItemProp2) => http.post(PORT3 + `/smashOut/send`, params);

// 7-查询工单下待入库接收的列表
export const smashOutListByWaitAccept = (params: defaultParams) => http.get(PORT3 + `/smashOut/listByWaitAccept/${params.id}`);

// 7.1-入库接收
export const smashOutAccept = (params: ItemProp2) => http.post(PORT3 + `/smashOut/accept`, params);

// 7.2-退回至未发送入库
export const smashOutBackSend = (params: ItemProp) => http.post(PORT3 + `/smashOut/backSend`, params);
